<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>代维调度待办列表</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui-win.css" />
    <link rel="stylesheet" href="../../script/ccssoft/css/ccssoft-lite.css" />
    <style media="screen">
      .numtip{
        display: inline-block;
        padding: 2px 3px;
        background-color:#1abc9c;
        color: #fff!important;
        line-height: normal!important;
        font-size: 10px;
        border-radius: 4px;
        margin-left: 5px;
        display: none;
        width: 14px;
        text-align: center;
      }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav ccssoft-aui-bar-theme" id="header">
        <a class="aui-btn ccssoft-aui-bar-theme aui-pull-left" id="back" onclick="api.closeWin();"> <span class="aui-iconfont aui-icon-left"></span> </a>
        <div class="aui-title" id='titname'>
            代维调度
        </div>
        <a id="menuBtn" class="aui-pull-right" tapmode onclick="openMenu()"> <span class="aui-iconfont aui-icon-settings"></span></a>
        <a class="aui-pull-right" tapmode onclick="showPopup()"> <span class="aui-iconfont aui-icon-search"></span> </a>
    </header>
    <div id="isshow" class="aui-tab" style="display:none;">
        <ul id="tabBox" class="aui-tab-nav">
        <li tabName = 'generationBillListFrm' id="activ1" class="active" tapmode>
                未领取<span class="numtip">0</span>
            </li>
            <li tabName = "generationBillListgetFrm" id="activ2" tapmode >
                已领取<span class="numtip">0</span>
            </li>
            <li tabName = "generationBillListFinshFrm" tapmode >
                已完成<span class="numtip">0</span>
            </li>
           <!--  <li tabName = "generationBillListFinshedFrm" tapmode >
                已归档<span class="numtip">0</span>
            </li> -->
            <li tabName = "generationBillListFrmNum" tapmode style="display:none;">
                站址模式
            </li>
        </ul>
    </div>
</body>
<script type="text/javascript" src="../../script/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/constant.js"></script>
<script type="text/javascript" src="../../script/debug.js"></script>
<script type="text/javascript" src="../../script/doT.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/client.api.js"></script>
<script type="text/javascript" src="../../script/aui-alert.js"></script>
<script type="text/javascript">
var query_setting;
    function isshow(istrue){
      if(istrue){
        $("#isshow").show();
        api.setFrameGroupAttr({
            name: 'xunjian_header_tab',
            rect : frameRect(),
            scrollEnabled:true
        });
        api.setFrameGroupIndex({
            name: 'xunjian_header_tab',
            index: 0
        });
      }else {
        $("#isshow").hide();
        api.setFrameGroupAttr({
            name: 'xunjian_header_tab',
            rect : frameRect1(),
            scrollEnabled:false
        });
        api.setFrameGroupIndex({
            name: 'xunjian_header_tab',
            index: 4
        });
      }
    }
    // 打开菜单
    function openMenu() {
        api.openFrame({
            name : 'generationBillMenuQh1',
            url : 'generationBillMenuQh1.html',
            bounces : false,
            rect : {
                x : 0,
                y : 0,
                w : 'auto',
                h : 'auto'
            },
            pageParam : api.pageParam,
            reload : true
        });
    }
    // 筛选页面
    function showPopup() {

        api.openFrame({
            name : 'popup_query_' + $('#tabBox li.active').attr('tabName'),
            url : '../dialog/popup_query.html',
            rect : {
                x : 0,
                y : 0,
                w : 'auto',
                h : 'auto'
            },
            bounces : false,
            reload : true,
            pageParam : query_setting
        });
    }

    refreshFrame = function() {
        var header = initHeader();
        var headerPos = $api.offset(header);
        var body_h = $api.offset($api.dom('body')).h;
        // wxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        api.openFrameGroup({
            name : 'xunjian_header_tab',
            rect : frameRect1(),
            preload : 0,
            scrollEnabled:false,
            index: 0,
            frames : [{
                name : 'generationBillListFrm',
                url : 'generationBillListFrm.html',
                pageParam : {
                  type:0
                },
                bounces : false
            },{
                name : 'generationBillListgetFrm',
                url : 'generationBillListFrm.html',
                pageParam : {
                  type:3
                },
                bounces : false
            }, {
                name : 'generationBillListFinshFrm',
                url : 'generationBillListFrm.html',
                pageParam : {
                  type:1
                },
                bounces : false
            },{
                name : 'generationBillListFinshedFrm',
                url : 'generationBillListFrm.html',
                pageParam : {
                  type:4
                },
                bounces : false
            },{
                name : 'generationBillListFrmNum',
                url : 'generationBillListFrm.html',
                pageParam : {
                  type:2
                },
                bounces : false
            }]
        }, function(ret, err) {
            if (ret) {
                $('#tabBox li:eq(' + ret.index + ')').addClass('active').siblings().removeClass('active');
                if(ret.index==0 || ret.index==1 || ret.index==2){
                    query_setting = {
                            stationNameOpt2 : true,
                            stationNameOpt3 : true,
                            stationNameOpt4 : true,
                            // stationNameOpt5 : true,
                            begintimetype:true,
                            winName : api.winName,
                            frameName : $('#tabBox li.active').attr('tabName'),
                            callback : 'cb_queryWaitTaskList'
                        };
                        $('#titname').html('工单模式');
                        $("#isshow").show();
                        api.setFrameGroupAttr({
                            name: 'xunjian_header_tab',
                            rect : frameRect(),
                            scrollEnabled:true
                        });
                }else {
                    query_setting = {
                            stationNameOpt2 : true,
                            winName : api.winName,
                            frameName : $('#tabBox li.active').attr('tabName'),
                            callback : 'cb_queryWaitTaskList'
                        };
                        $('#titname').html('站址模式');

                }
            }
        });
        /*jquery事件:tab切换*/
        $('#tabBox li').click(function() {
            $(this).addClass('active').siblings().removeClass('active');
            if(!$(this).index()){  //回单完成后需要刷新页面
              api.sendEvent({
                  name: 'receive',  //领取
                  extra: {
                  }
              });
            }else{
              api.sendEvent({
                  name: 'receipt',  //回单
                  extra: {
                  }
              });
            }
            api.setFrameGroupIndex({
                name : 'xunjian_header_tab',
                index : $(this).index(),
                scroll : true
            });
        });

    }
    apiready = function() {
        refreshFrame();
        $api.addEvt($api.byId('back'), 'click', function() {
            api.closeWin();
        });
        //回完单后监听已领取页面是否还有该站址数据
        api.addEventListener({
            name: 'myDeleteClsEvent'
        }, function(ret, err){
            api.setFrameGroupIndex({
                name : 'xunjian_header_tab',
                index : 0,
                scroll : true
            });
            $("#activ2").removeClass('.active');
            $("#activ1").addClass('.active');
        });
    };

    function changetipnum(num,type){
      if(type==1){
        $('.numtip').eq(0).html(num);
        $('.numtip').eq(0).show(0);
      }else if(type==2) {
        $('.numtip').eq(1).html(num);
        $('.numtip').eq(1).show(0);
      }else if(type==3) {
        $('.numtip').eq(2).html(num);
        $('.numtip').eq(2).show(0);
      }else if(type==4) {
        $('.numtip').eq(3).html(num);
        $('.numtip').eq(3).show(0);
      }
    }
</script>

</html>
